<script>
import customeApi from '@/service/custome.js';
export default {
	onLaunch() {},
	globalData: {
		backMerchantUrl: '',
		tokenRyy:'', //融医药提现或者绑卡时跳转带过来的token
		allCanPrice:'', //融医药提现时跳转带过来的可提现金额
		
		miniType:'', //是否外部小程序（ 中灿/药箱 ）跳转过来提现的标识---OtherMiniCashOut
	},
	onShow(options) {
		// console.log('App Show')
		// if (!this.$store.state.tim.status && this.$store.state.index.role) {
		// 	this.getIM();
		// }
		if (options.referrerInfo && options.referrerInfo.extraData) {
			// 通联支付的认证成功之后的回调信息
			this.globalData.backMerchantUrl = options.referrerInfo.extraData.backMerchantUrl;
			this.globalData.tokenRyy = options.referrerInfo.extraData.tokenRyy;
			this.globalData.allCanPrice = options.referrerInfo.extraData.allCanPrice;
			
			this.globalData.miniType = options.referrerInfo.extraData.miniType;
			console.log(options,'Show-Show-Show-Show-Show-Show-Show-Show-Show');
			// uni.showToast({
			// 	title: '认证成功',
			// 	icon: 'success',
			// 	duration: 2000
			// });
			if(this.globalData.backMerchantUrl){
				uni.navigateTo({
					url: '/pages_Verification/verification/status/sign'
				});
			}
		}
	},
	onHide() {
		// console.log('App Hide')
	},
	computed: {
		timMsg() {
			return this.$store.state.tim.msg;
		},
		token() {
			return this.$store.state.index.token;
		}
	},
	methods: {
		getIM() {
			customeApi.getIM().then(res => {
				if (res.code === 1) {
					uni.setStorageSync('timInfo', {
						userID: res.data.im_user,
						userSig: res.data.sig
					});
					this.$tim.login(res.data.im_user, res.data.sig);
				} else {
					this.$utils.showErr({ title: res.msg });
				}
			});
		}
	},
	watch: {
		timMsg(newVal, oldVal) {
			console.log(newVal);
			if (newVal.from && newVal.from !== 'system') {
				this.$store.commit('tim/SET_timNoread', {
					account: newVal.from,
					value: 1
				});
			}
		},
		token(newVal, oldVal) {
			if (newVal && this.$store.state.index.role) {
				// this.getIM();
			} else {
				this.$tim.logout();
			}
		}
	}
};
</script>

<style lang="scss">
// uView
@import '@/plugins/uview-ui/index.scss';
// 字体图标
@import '@/icons/iconfont.css';
//公共样式
@import '@/common/css/iconfont.css';
@import '@/common/css/common.css';
@import '@/common/css/wanlshop.css';
@import '@/common/css/colorui.css';

@import "@/static/styles/Flex.less";
@import "@/static/styles/common.less";

// 重置样式
page {
	color: #333;
	font-size: 28rpx;
	background: #f6f7fb;
	font-family: PingFang SC;
}
image {
	width: 100%;
	height: 100%;
	display: block;
}
input {
	min-height: 0;
}
view,
scroll-view,
swiper,
swiper-item,
cover-view,
cover-image,
icon,
text,
rich-text,
progress,
button,
checkbox,
form,
input,
label,
radio,
slider,
switch,
textarea,
navigator,
audio,
camera,
image,
video {
	box-sizing: border-box;
}
button::after {
	border: none;
}
swiper {
	height: 100%;
}

// 公共样式
/* input 样式 */
.placeholder {
	color: #939393;
}
/* 超出多行省略 */
.omit-1 {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.omit-2 {
	display: -webkit-box;
	overflow: hidden;
	white-space: normal !important;
	text-overflow: ellipsis;
	word-wrap: break-word;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}
.omit-3 {
	display: -webkit-box;
	overflow: hidden;
	white-space: normal !important;
	text-overflow: ellipsis;
	word-wrap: break-word;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}
.omit-4 {
	display: -webkit-box;
	overflow: hidden;
	white-space: normal !important;
	text-overflow: ellipsis;
	word-wrap: break-word;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
}
// 隐藏滚动条
.hide-scroll ::-webkit-scrollbar {
	display: none;
	width: 0 !important;
	height: 0 !important;
	-webkit-appearance: none;
	background: transparent;
}
/* 解决小程序和app滚动条的问题 */
/* #ifdef MP-WEIXIN || APP-PLUS */
::-webkit-scrollbar {
	display: none;
}
/* #endif */

/* 解决H5 的问题 */
/* #ifdef H5 */
uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
	/* 隐藏滚动条，但依旧具备可以滚动的功能 */
	display: none;
}
/* #endif */

.of-hidden {
	overflow: hidden !important;
}
.hide {
	display: none !important;
}
.hide-vsb {
	visibility: hidden !important;
}
.pR-32 {
	padding-right: 32rpx !important;
}
.mR-4 {
	margin-right: 4rpx !important;
}
.col-fff {
	color: #fff !important;
}
.col-666 {
	color: #666 !important;
}
.col-c6 {
	color: #c6c6c6 !important;
}
.col-ccc {
	color: #ccc !important;
}
.fs-16 {
	font-size: 16rpx !important;
}
.fs-20 {
	font-size: 20rpx !important;
}
.fs-24 {
	font-size: 24rpx !important;
}
.fs-28 {
	font-size: 28rpx !important;
}
.ft-normal {
	font-weight: normal !important;
}
.ft-bold {
	font-weight: bold !important;
}

.titleNview-placing {
	height: var(--status-bar-height);
	padding-top: 44px;
	box-sizing: content-box;
}

// 修改uView样式
.u-loading {
	display: flex;
	justify-content: center;
	align-items: center;
}

/* 微信中checkbox样式 */
/* #ifdef APP-PLUS ||MP-WEIXIN */
checkbox .wx-checkbox-input {
	border-radius: 50% !important;
	color: #ffffff !important;
	// transform: scale(0.8);
}
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
	color: #fff;
	background: #dba954;
}
.wx-checkbox-input.wx-checkbox-input-checked {
	border: 2rpx solid #dba954;
}
/* #endif */
</style>
